<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('notice_user', function (Blueprint $table) {
            $table->id()->comment('主键id');
            $table->foreignId('notice_id')->constrained('notices')->onDelete('cascade');
            $table->foreignId('user_id')->constrained('users')->onDelete('cascade');
            $table->tinyInteger('is_read')->default(0)->comment('是否已读(0-未读 1-已读)');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('notice_user');
    }
};
